package com.itheima_2;

public class Demo_3 {
    public static void main(String[] args) {
       /* Ticket1 ticket1=new Ticket1();
        Thread t1=new Thread(ticket1);
        Thread t2=new Thread(ticket1);
        Thread t3=new Thread(ticket1);
        t1.setName("窗口一");
        t2.setName("窗口二");
        t3.setName("窗口三");
        t1.start();
        t2.start();
        t3.start();*/
       /* Ticket1 ticket=new Ticket1();
        Thread t1=new Thread(ticket);
        Thread t2=new Thread(ticket);
        Thread t3=new Thread(ticket);
        t1.setName("窗口一");
        t2.setName("窗口二");
        t3.setName("窗口三");
        t1.start();
        t2.start();
        t3.start();*/
        //同步代码块可以锁住指定代码
        /*MyTread mt1=new MyTread();
        MyTread mt2=new MyTread();
        mt1.setName("窗口一");
        mt2.setName("窗口二");
        mt1.start();
        mt2.start();*/
        MyRunnable mr=new MyRunnable();
        Thread t1=new Thread(mr);
        Thread t2=new Thread(mr);
        t1.setName("窗口一");
        t2.setName("窗口二");
        t1.start();
        t2.start();
    }
}
